package com.vsoft.sms_cm;

import java.io.DataOutputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;

import org.apache.log4j.Logger;

import com.vsoft.framework.core.BaseException;
import com.vsoft.framework.core.BusiObj;
import com.vsoft.framework.core.Configuration;
import com.vsoft.framework.core.db.DBGadgets;
import com.vsoft.framework.core.db.DBTrans;
import com.vsoft.framework.core.esb.ServiceBus;
import com.vsoft.framework.core.util.BOHelper;
import com.vsoft.framework.core.util.LogCollect;
import com.vsoft.framework.core.util.XMLUtil;
import com.vsoft.framework.server.servlet.SessionData;
import com.vsoft.framework.server.servlet.HttpUtil;
import com.vsoft.anti_fra.*;

public class TestBIZLog {

	private static Logger vLogger = Logger.getLogger(TestBIZLog.class);
	private static String vName = TestBIZLog.class.getName();
	private SessionData vSD = null;
	private String vDebugHome = "";
	private BusiObj				vInBO		=  new BusiObj();
	
	
	public static void main(String[] args)  {
	
		try{

			vLogger.info("---------------InitSystem-------------");
			Configuration.InitSystem();
			vLogger.info("---------------generate test data-------------");

			TestBIZLog t = new TestBIZLog();
			Connection conn = DBTrans.getConnection();

			t.vInBO.setString("cust_name", "interface test");
			t.vInBO.setString("mobile_num", "1212");
			t.vInBO.setString("phone_num", "");
			///////////////////////////////////////////////
			t.vInBO.setString("area_no", "0566");
			t.vInBO.setString("log_state", "1");
			t.vInBO.setString("log_desc", "success");
			t.vInBO.setString("order_num", "5112391");
			///////////////////////////////////////////////			
			t.vInBO.setString("email", "");
			t.vInBO.setString("fax", "");
			t.vInBO.setString("address", "interface test");
			t.vInBO.setString("order_no", "10566213");

			t.vInBO.setString("notes", "ssssssss");

			t.vInBO.setConnection(conn);
			t.vInBO.setName("BizSF");
			t.vInBO.setString("SESSION_STAFF_NO", "999");
			t.vInBO.setString("debugSee", "1");
			Order order = new Order(); 
			order.updateLogBiz(t.vInBO);
			DBGadgets.check(conn); 
			conn.rollback(); 
			//conn.commit();
			conn.close(); 
			//vLogger.info("返回数据是:\n\n\n\n" + BOHelper.boToXML(retBo));
			// select * from  log_BizSF  where   LOG_BIZSF_SN in(select max(LOG_BIZSF_SN) from log_BizSF where area_no='0566' and order_num='5112391') ;
		}
		catch(SQLException e)
		{
			e.printStackTrace();
		}
		catch(BaseException e)
		{
			e.printStackTrace();
			vLogger.error(e.ErrMethod);
			vLogger.error(e.SysMsg);
		}
			vLogger.info("---------------Game Over-------------");
	}	
	
		

	private int  init()
	{
		int iRet = 0;
		vSD = new  SessionData();
		vSD.vRoleCode = new String[] {"1"};
		vSD.vStaffCode = "1";
		vSD.vStaffNo = "0001";
		vSD.vStaffName = "test";
		
	
		vDebugHome = System.getProperty("DEBUG_HOME");
		if (vDebugHome == null)
		{
			iRet = -1;
			vLogger.error("需要设置DEBUG_HOME环境变量来指定debug 文件所在的目录");
		}
		return iRet;
		
	}
	
}
